<!DOCTYPE html>
<html lang="zh-cn">
<head>
  <include file="Public:head"/>
</head>
<body>
<div class="panel admin-panel">
  <div class="panel-head"><strong><span class="icon-key"></span> 修改会员密码</strong></div>
  <div class="body-content">
    <form method="post" class="form-x" action="">
      <div class="form-group">
        <div class="label">
          <label for="sitename">管理员帐号：</label>
        </div>
        <div class="field">
          <label style="line-height:33px;">
          {$name}
          </label>
        </div>
      </div>      
      <div class="form-group">
        <div class="label">
          <label for="sitename">原密码：</label>
        </div>
        <div class="field">
          <input type="password" class="input w50" id="mpass" name="oldpassword" size="50" placeholder="请输入原始密码" data-validate="required:请输入原始密码" />
        </div>
      </div>      
      <div class="form-group">
        <div class="label">
          <label for="sitename">新密码：</label>
        </div>
        <div class="field">
          <input type="password" class="input w50" name="password" size="50" placeholder="请输入新密码" data-validate="required:请输入新密码,length#>=6:新密码不能小于5位" />
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label for="sitename">确认新密码：</label>
        </div>
        <div class="field">
          <input type="password" class="input w50" name="repassword" size="50" placeholder="请再次输入新密码" data-validate="required:请再次输入新密码,repeat#password:两次输入的密码不一致" />
        </div>
      </div>
      
      <div class="form-group">
        <div class="label">
          <label></label>
        </div>
        <div class="field">
          <button class="button bg-main icon-check-square-o tj_btn" type="button"> 提交</button>
        </div>
      </div>      
    </form>
  </div>
</div>
</body></html>
<script type="text/javascript" src="/Public/js/md5.js"></script>
<script type="text/javascript">
    $('.tj_btn').click(function(){
        if($('input[name="oldpassword"]').val()!=''){
            $('input[name="oldpassword"]').val(hex_md5($('input[name="oldpassword"]').val()));
        }
        if($('input[name="password"]').val()!=''){
            $('input[name="password"]').val(hex_md5($('input[name="password"]').val()));
        }
        if($('input[name="repassword"]').val()!=''){
            $('input[name="repassword"]').val(hex_md5($('input[name="repassword"]').val()));
        }
        $.post("{:U('repassword')}",$('.form-x').serialize(),function(msg){
            if(msg.status == 0){
                $('input[name="oldpassword"]').val('');
                $('input[name="password"]').val('');
                $('input[name="repassword"]').val('');
                sweetAlert({title:'',text: msg.info,type: "warning",timer:2000,showConfirmButton: false});
            }
            if(msg.status == 1){
                sweetAlert({title:'',text: msg.info,type: "success",showConfirmButton: false});
                setTimeout(function(){window.location.reload()},1000);
            }
        });
    });
</script>